<template>
  <van-sticky :offset-top="top ? top : 0">
    <van-notice-bar :text="noticeData" left-icon="volume-o" class="notice" v-if="noticeData !== ''"/>
  </van-sticky>
</template>

<script>
export default {
  props: ['top'],
  data () {
    return {
      noticeData: ''
    }
  },
  methods: {
    getNotice () {
      this.$axios.get('/api/rollnews').then(res => {
        if (res.status === 200) {
          this.noticeData = res.data[0].info
        }
      })
    }
  },
  created () {
    this.getNotice()
  }
}
</script>

<style lang="scss">
.notice{
  height: .48rem;
  color: #2E82FA;
  font-size: .24rem;
  background: #e1eaf7;
  .van-notice-bar__content{
    font-size: .24rem;
  }
}
</style>
